﻿@using AdminWeb.Models
@using AdminWeb.Views
@using NougakudoCompanion.Commons

<div class="wraper">
  <div class="pagetilte">NougakuDo Running Logs</div>
    @{
        using (Html.BeginForm("OperateApplications", "Admin"))
        {
            Runtime runtime = ViewBag.Runtime;
            var logs = new NougakudoLogs(runtime);
            var instances = logs.Instances;
            var logdata = logs.Logs;
            foreach (var instance in instances)
            {
  <div class="grey-border-alt">
    <div class="table-head">InstanceID:@instance</div>
    <table width="100%" class="body-content" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="20%" class="tab-head">Application</td>
        <td width="10%" class="tab-head">Status</td>
        <td width="15%" class="tab-head">Process ID</td>
        <td width="10%" class="tab-head">Version</td>
        <td width="15%" class="tab-head"># of process</td>
        <td width="10%" class="tab-head">Environment</td>
        <td width="20%" class="tab-head">Operation</td>
      </tr>
                @foreach (var row in logdata[instance])
                {
                    var cols = Helper.GetColums(row);
      <tr>
        <td>@Html.Encode(cols[1])</td>
        <td>@Html.Encode(cols[0])</td>
        <td>@Html.Encode(cols[2])</td>
        <td>@Html.Encode(cols[3])</td>
        <td>@Html.Encode(cols[4])</td>
        <td>@Html.Encode(cols[5])</td>
        <td>@Html.DropDownList("Ope-" + instance + "-" + cols[1], ViewHelper.GetOperation(cols[0]))</td>
      </tr>
                }
                @if (logdata[instance].Count() == 0)
                {
      <tr>
        <td colspan="7">No Applications</td>
      </tr>
                }
                
    </table>
  </div>
  <p></p>
            }
  <div class="floatRight">
    <br/>
    <input type="submit" title="Operartion to application" value="Operation" class="btnOrange" />
  </div>
        }
    }

</div>

